Improve translation for Mac; now reads .qms from the bundle.
authorrobertl <robertl>
Sun, 6 Jun 2010 00:49:08 +0000 (00:49 +0000)
committerrobertl <robertl>
Sun, 6 Jun 2010 00:49:08 +0000 (00:49 +0000)
gui/gpsbabelfe_it.qm
gui/gpsbabelfe_it.ts
gui/main.cpp
tools/mac-localize [new file with mode: 0755]

index fb51620fc1b942ba9479a5adf2884e3413b3141d..ce06aba78640782153160719d643558f88994fc8 100644 (file)
Binary files a/gui/gpsbabelfe_it.qm and b/gui/gpsbabelfe_it.qm differ
index bfccd95acbd1a55867ae2308091ec596845ef5bc..c7d588eafd8120b18c40da3e249edc34864b00af 100644 (file)
@@ -459,7 +459,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwindow.cpp" line="561"/>
         <source>waypoints</source>
-        <translation type="unfinished"></translation>
+        <translation></translation>
     </message>
     <message>
         <location filename="mainwindow.cpp" line="562"/>
@@ -520,7 +520,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwindow.cpp" line="898"/>
         <source>Translation successful</source>
-        <translation type="unfinished"></translation>
+        <translation type="unfinished">Translation Opzioni</translation>
     </message>
     <message>
         <location filename="mainwindow.cpp" line="908"/>
@@ -632,7 +632,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwinui.ui" line="218"/>
         <source>Translation Options</source>
-        <translation type="unfinished"></translation>
+        <translation>Translation Opzioni</translation>
     </message>
     <message>
         <location filename="mainwinui.ui" line="227"/>
@@ -649,7 +649,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwinui.ui" line="240"/>
         <source>Waypoints</source>
-        <translation type="unfinished">Punti di interesse</translation>
+        <translation>Punti di interesse</translation>
     </message>
     <message>
         <location filename="mainwinui.ui" line="277"/>
@@ -659,7 +659,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwinui.ui" line="280"/>
         <source>Routes</source>
-        <translation type="unfinished">Rotte</translation>
+        <translation>Rotte</translation>
     </message>
     <message>
         <location filename="mainwinui.ui" line="317"/>
@@ -669,7 +669,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwinui.ui" line="320"/>
         <source>Tracks</source>
-        <translation type="unfinished">Tracce</translation>
+        <translation>Tracce</translation>
     </message>
     <message>
         <location filename="mainwinui.ui" line="356"/>
@@ -694,7 +694,7 @@ This program cannot continue.</source>
     <message>
         <location filename="mainwinui.ui" line="405"/>
         <source>Output</source>
-        <translation type="unfinished">Destinazione</translation>
+        <translation>Destinazione</translation>
     </message>
     <message>
         <location filename="mainwinui.ui" line="425"/>
index dd3a46f9b8c0641f24c12b623bda28f7663ce010..822184508b8e4d488e18c6565a5b9b6727e36ed9 100644 (file)
@@ -1,5 +1,5 @@
 // -*- C++ -*-
-// $Id: main.cpp,v 1.7 2010/05/19 11:41:02 robertl Exp $
+// $Id: main.cpp,v 1.8 2010/06/06 00:49:08 robertl Exp $
 //------------------------------------------------------------------------
 //
 //  Copyright (C) 2009  S. Khai Mong <khai@mangrai.com>.
@@ -37,15 +37,32 @@ const char *pathSeparator = ";";
 const char *pathSeparator = ":";
 #endif
 
+#if defined (Q_OS_MAC)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
 //------------------------------------------------------------------------
 static void installTranslation(QApplication *app, const QString &nm)
 {
   QTranslator *xlator = new QTranslator();
-fprintf(stderr, "Loading %s\n", qPrintable(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + nm + QLocale::system().name()));
+
   xlator->load(QLibraryInfo::location(QLibraryInfo::TranslationsPath) + "/" + nm + QLocale::system().name());
 
-fprintf(stderr, "...Loading %s\n", qPrintable(nm + QLocale::system().name()));
   xlator->load(nm + QLocale::system().name());
+
+#if defined (Q_OS_MAC)
+  CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
+  CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
+                                           kCFURLPOSIXPathStyle);
+  QString pathPtr(CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()));
+  pathPtr += "/Contents/MacOS/lang/" + nm;
+  // pathPtr +=  QLocale::system().name().left(2);
+  pathPtr +=  QLocale::system().name();
+
+  xlator->load(pathPtr);
+
+#endif
+
   app->installTranslator(xlator);
 }
 
diff --git a/tools/mac-localize b/tools/mac-localize
new file mode 100755 (executable)
index 0000000..f34e720
--- /dev/null
@@ -0,0 +1,12 @@
+# Creating even empty (?!?!) directories is enough to trigger the merge
+# of the trnslations for the application menu.  This isn't as ambitious
+# as described at 
+# http://doc.qt.nokia.com/4.6/mac-differences.html#translating-the-application-menu-and-native-dialogs
+# but at least for German, it seems to work.
+#
+
+cd gui 
+for i in $(echo  gpsbabelfe_??.ts | sed 's/gpsbabelfe_\(..\).ts/\1/g')
+do
+  mkdir objects/gpsbabelfe-bin.app/Contents/Resources/$i.lproj 
+done